﻿#include <func.h>

int InitDynArray(DynArray* Array) {
    Array->count = 0;
    Array->capcity = DynArrayBeginCap;
    Array->data = (pTkWord*)calloc(DynArrayBeginCap, sizeof(pTkWord));
}
int WriteTDynArray(DynArray* Array, pTkWord v) {

    if (Array->count > Array->capcity - 1)
    {
        Array->capcity = Array->capcity * 2;
        if (!(Array->data = (pTkWord*)realloc(Array->data, Array->capcity * sizeof(pTkWord))))
        {
            return -1;
        }
    }
    (Array->data)[Array->count++] = v;
    return 0;
}
int PrintDynArray(DynArray Array) {
    for (int i = 0; i < Array.count; i++)
    {
        printf("%d %s\n", Array.data[i]->tkcode, Array.data[i]->spelling);
    }
}
